package com.fanrenqiji.entity;


import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Set;

/**
 * Created by yanwt on 2017/1/3.
 * 学员信息表
 */
@Entity
@Table(name = "tb_student")
@org.hibernate.annotations.Table(appliesTo = "tb_student", comment = "学员信息表")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region = "student", usage = CacheConcurrencyStrategy.READ_WRITE)
public class StudentEntity extends DataEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(columnDefinition = ("varchar(100) default null comment '学生姓名'"))
    private String name;

    @Column(name = "login_name", columnDefinition = ("varchar(50) default null comment '登陆账号'"))
    private String loginName;

    @Column(columnDefinition = ("varchar(20) default null comment '联系电话'"))
    private String phone;

    @Column(name = "identification_code", columnDefinition = ("varchar(50) default null comment '身份证号码'"))
    private String identificationCode;

    @Column(name = "nike_name", columnDefinition = ("varchar(100) default null comment '昵称'"))
    private String nikeName;

    @Column(columnDefinition = ("varchar(50) default null comment '密码'"))
    private String password;

    @Column(columnDefinition = ("varchar(200) default null comment '头像'"))
    private String portrait;

    @Column(name = "sex", columnDefinition = ("int(1) not null comment '性别 0:女 1:男'"))
    private String sex;

    @Column(name = "age", columnDefinition = ("int(11) not null comment '年龄'"))
    private String age;

    @Column(name = "class_name", columnDefinition = ("varchar(200) default null comment '班级名称'"))
    private String className;

    @Column(name = "school_name", columnDefinition = ("varchar(200) default null comment '学校名称'"))
    private String schoolName;

    @Column(columnDefinition = ("varchar(200) default null comment '特长'"))
    private String speciality;

    @Column(name = "medical_history", columnDefinition = ("varchar(200) default null comment '疾病过敏史'"))
    private String medicalHistory;

    @Column(name = "registration_date", columnDefinition = ("date default null  comment '报读日期'"))
    private Date registrationDate;

   /* @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "camp_period_id", columnDefinition = ("bigint(20) default null comment '营期ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
  /*  @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private CampPeriodEntity campPeriod;*/

  /*  @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "class_room_id", columnDefinition = ("bigint(20) default null comment '班级ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
  /*  @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private ClassRoomEntity classRoom;*/

    @Column(name = "grade_id", columnDefinition = ("int(11) default null comment '年级ID'"))
    private int gradeId;

/*    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "grade_id", insertable = false, updatable = false, columnDefinition = ("int(11) default null comment '年级ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
 /*   @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private GradeEntity grade;*/

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "parent_id", columnDefinition = ("bigint(20) default null comment '父母ID'"))
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private ParentEntity parent;

 /*   @ManyToMany(mappedBy = "allStudents")
    @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private List<ParentEntity> parents;*/

/*    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "counselor_id", columnDefinition = ("bigint(20) default null comment '辅导老师ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
  /*  @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private TeacherEntity counselor; //辅导老师*/

    @Column(columnDefinition = ("varchar(50) default null comment '学生来源'"))
    private String source;

    @Column(name = "total_class_hours", columnDefinition = ("int(11) default null comment '总课时数'"))
    private int totalClassHours;

    @Column(columnDefinition = ("int(11) default null comment '总积分'"))
    private int point;

    @Column(name = "delay_times", columnDefinition = ("int(11) not null comment '延期次数'"))
    private int delayTimes;

    @Column(columnDefinition = "tinyint(1) default null comment '状态:-1:锁定 0:新增 1:激活 '")
    private int status;

/*    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "company_id", insertable = false, updatable = false, columnDefinition = ("bigint(20) default null comment '公司ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    /*@Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private OfficeEntity office;*/

    @Column(name = "company_id", columnDefinition = ("bigint(20) not null comment '公司ID'"))
    private Long companyId;

 /*   @OneToMany
    @JoinColumn(name = "student_id", columnDefinition = ("bigint(20) default null comment '学生ID'"))*/
//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
   /* @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private Set<ParentDailyScoreEntity> studentDailyScores;*/

    @Version
    private int version;

    @Column(name = "timetable_version", columnDefinition = ("int(11) default null comment '生成课表版本'"))
    private int timetableVersion;

    @Column(columnDefinition = ("varchar(50) default null comment '营销人员'"))
    private String marketing;

    @Column(columnDefinition = ("varchar(50) default null comment '销售讲师'"))
    private String lecturer;

    @Column(columnDefinition = ("varchar(50) default null comment '销售主管'"))
    private String manager;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getIdentificationCode() {
        return identificationCode;
    }

    public void setIdentificationCode(String identificationCode) {
        this.identificationCode = identificationCode;
    }

    public String getNikeName() {
        return nikeName;
    }

    public void setNikeName(String nikeName) {
        this.nikeName = nikeName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPortrait() {
        return portrait;
    }

    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public String getSpeciality() {
        return speciality;
    }

    public void setSpeciality(String speciality) {
        this.speciality = speciality;
    }

    public String getMedicalHistory() {
        return medicalHistory;
    }

    public void setMedicalHistory(String medicalHistory) {
        this.medicalHistory = medicalHistory;
    }

    public Date getRegistrationDate() {
        return registrationDate;
    }

    public void setRegistrationDate(Date registrationDate) {
        this.registrationDate = registrationDate;
    }

    public int getGradeId() {
        return gradeId;
    }

    public void setGradeId(int gradeId) {
        this.gradeId = gradeId;
    }

/*    public ParentEntity getParent() {
        return parent;
    }

    public void setParent(ParentEntity parent) {
        this.parent = parent;
    }*/

/*    public List<ParentEntity> getParents() {
        return parents;
    }

    public void setParents(List<ParentEntity> parents) {
        this.parents = parents;
    }*/

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public int getTotalClassHours() {
        return totalClassHours;
    }

    public void setTotalClassHours(int totalClassHours) {
        this.totalClassHours = totalClassHours;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public int getDelayTimes() {
        return delayTimes;
    }

    public void setDelayTimes(int delayTimes) {
        this.delayTimes = delayTimes;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public int getTimetableVersion() {
        return timetableVersion;
    }

    public void setTimetableVersion(int timetableVersion) {
        this.timetableVersion = timetableVersion;
    }

    public String getMarketing() {
        return marketing;
    }

    public void setMarketing(String marketing) {
        this.marketing = marketing;
    }

    public String getLecturer() {
        return lecturer;
    }

    public void setLecturer(String lecturer) {
        this.lecturer = lecturer;
    }

    public String getManager() {
        return manager;
    }

    public void setManager(String manager) {
        this.manager = manager;
    }

    public ParentEntity getParent() {
        return parent;
    }

    public void setParent(ParentEntity parent) {
        this.parent = parent;
    }
}

